﻿using ERP.Workflow.Designer.BlazorUI.Core;
using ERP.Workflow.Designer.BlazorUI.Models;
using ERP.Workflow.Designer.Domain.Shared;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Extensions.Localization;
using ERP.Workflow.Designer.Domain.Shared.Localization;

namespace ERP.Workflow.Designer.BlazorUI.Provider
{
    public class ToolBoxItem
    { 
        public string? Title { get; set; }   
        public string? Description { get; set; }
        public string? Icon { get; set; }
        public int Rotate { get; set; }
        public string? Name { get; set; }
        public Type? ModelData { get; set; }

    }
    public interface IToolBoxProvider
    {
        public List<ToolBoxItem> Define();
        
    }
    public class ToolBoxProvider : IToolBoxProvider
    {
         protected IStringLocalizer<WorkflowDesignerResource> L;

        public ToolBoxProvider(IStringLocalizer<WorkflowDesignerResource> l)
        {
            L = l;
        }

        public virtual List<ToolBoxItem> Define()
        {
           
           
            return new List<ToolBoxItem>() 
            {
                  
              //  new ToolBoxItem{ Title="选择", Name="Select", Icon="arrow-up", Rotate=-45, ModelData=typeof(FlowNode) },
                new ToolBoxItem{ Title=L[nameof(NodeType.Start)], Name=nameof(NodeType.Start), Icon="play-circle", ModelData=typeof(FlowNode) },

                new ToolBoxItem{ Title=L[nameof(NodeType.General)], Name=nameof(NodeType.General), Icon="form", ModelData=typeof(FlowNode) },

                new ToolBoxItem{ Title=L[nameof(NodeType.ANDStart)], Name=nameof(NodeType.ANDStart), Icon="partition", Rotate=90, ModelData=typeof(FlowNode) },
                new ToolBoxItem{ Title=L[nameof(NodeType.ANDEnd)], Name=nameof(NodeType.ANDEnd), Icon="partition", Rotate=-90, ModelData=typeof(FlowNode) },

                new ToolBoxItem{ Title=L[nameof(NodeType.ORStart)], Name=nameof(NodeType.ORStart), Icon="fork", Rotate=180,  ModelData=typeof(FlowNode) },
                new ToolBoxItem{ Title=L[nameof(NodeType.OREnd)], Name=nameof(NodeType.OREnd), Icon="fork", ModelData=typeof(FlowNode) },

                new ToolBoxItem{ Title=L[nameof(NodeType.XORStart)], Name=nameof(NodeType.XORStart), Icon="branches", Rotate=180, ModelData=typeof(FlowNode) },
                new ToolBoxItem{ Title=L[nameof(NodeType.XOREnd)], Name=nameof(NodeType.XOREnd), Icon="branches", ModelData=typeof(FlowNode) },

                new ToolBoxItem{ Title=L[nameof(NodeType.End)], Name=nameof(NodeType.End), Icon="pause-circle", ModelData=typeof(FlowNode) },
               // new ToolBoxItem{ Title="处理程序", Name="todo", Icon="setting", ModelData=typeof(FlowNode) },
                
            };
        }
    }
}
